package com.wb.adutils.db

import androidx.room.*

@Dao
interface AdDao {

    @Query("SELECT * FROM `AdEntity` WHERE adTemplate = :adTemplate")
    fun queryAd(adTemplate: Int): AdEntity?

    @Query("SELECT * FROM `AdEntity` ")
    fun queryAll(): List<AdEntity>?

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(adEntity: AdEntity)

    @Update
    fun update(adEntity: AdEntity)

    @Query("DELETE FROM `AdEntity` WHERE adTemplate=:adTemplate")
    fun delete(adTemplate: Int)

    @Query("DELETE FROM `AdEntity`")
    fun deleteAll()
}